<%@page import="com.bdc.util.ResourceUtil"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.bdc.bean.Product"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../i18n_label.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=titelLabel%></title>

<link rel="stylesheet" type="text/css" href="../../css/colorbox.css" media="screen" />
	
	<link rel="stylesheet" type="text/css" href="../../css/all_products.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="../../css/header_footer.css"   media="screen"/>
	
	<script type="text/javascript" src="../../js/jquery/jquery-1.5.min.js"></script>
	<script type="text/javascript" src="../../js/util/jquery.colorbox.js"></script> 
	<script type="text/javascript" src="../../js/all_products.js"></script>
</head>
<body>
	<div id='header' class='wrapper_header'>
		<div class="header-home">
			<a href="/baodacraft?pageId=0"><%=homeLabel%></a>
		</div>
		
		<ul id="header_nav" class="nav-left">
			<li>
				<a href="#"><%=allProductsLabel%></a>
				<ul>
					<li><a href="all_products_1.html">hanger</a></li>
					<li><a href="all_products_2.html">garden prong</a></li>
					<li><a href="all_products_3.html">bird feeder</a></li>
					<li><a href="all_products_4.html">cushion</a></li>
				</ul>
				<div class="clear"></div>
			</li>
		</ul>
		
		<ul id="header_nav" class="nav-right">
			<li>
				<a href="#">contact us</a>
				<ul>
					<li><a href="#">baodacraft@baodacraft.com</a></li>
				</ul>
				<div class="clear"></div>
			</li>
		</ul>
	</div>
	
	<div id="page-wrap">
	
		<h1>Animal Craft</h1>
		
		<br />
		<input type="hidden" value="<%=(String)request.getAttribute("productType")%>" id="productType" />

		<table>
			<tr>
				<% 
					List<Product> products = (ArrayList<Product>)request.getAttribute("products");
					int size = products.size();
					int nextPage = Integer.parseInt((String)request.getAttribute("nextPageIndex"));
					String productType = (String)request.getAttribute("productType");
					boolean hasNextPages = ((Boolean)request.getAttribute("hasNextPages")).booleanValue();
				%>
				<%
					for(int i = 0; i < 8; i++) {
						if(i < size) {
						Product product = products.get(i);
				%>
				<td>
					<div class="photo_slider">
						<div class="photo_slider_img">
							<img src="../../images/product/<%=product.getType()%>/small/<%=product.getImageName()%>.jpg"/>
						</div>
						<a class="more_info" href="../../images/product/<%=product.getType()%>/big/<%=product.getImageName()%>.jpg" rel="example1" title="test!!"></a>
					</div>
				</td>
				<%		
						} else { 
				%>
				<td></td>
				<%		
						}
					}
				%>
				<td></td>
				<td></td>
			</tr>
			
			<tr>
				<td></td>
				<%
					for(int i = 8; i < 16; i++) {
						if(i < size) {
						Product product = products.get(i);
				%>
				<td>
					<div class="photo_slider">
						<div class="photo_slider_img">
							<img src="../../images/product/<%=product.getType()%>/small/<%=product.getImageName()%>.jpg"/>
						</div>
						<a class="more_info" href="../../images/product/<%=product.getType()%>/big/<%=product.getImageName()%>.jpg" rel="example1" title="test!!"></a>
					</div>
				</td>
				<%		
						} else { 
				%>
				<td></td>
				<%		
						}
					}
				%>
				<td></td>
			</tr>
			
			<tr>
				<td></td>
				<td></td>
				<%
					for(int i = 16; i < 24; i++) {
						if(i < size) {
						Product product = products.get(i);
				%>
				<td>
					<div class="photo_slider">
						<div class="photo_slider_img">
							<img src="../../images/product/<%=product.getType()%>/small/<%=product.getImageName()%>.jpg"/>
						</div>
						<a class="more_info" href="../../images/product/<%=product.getType()%>/big/<%=product.getImageName()%>.jpg" rel="example1" title="test!!"></a>
					</div>
				</td>
				<%		
						} else { 
				%>
				<td></td>
				<%		
						}
					}
				%>
			</tr>
		</table>
	</div>
	
	<div>
		<% 
			if(nextPage > 0) {
		%>
		<div class="prev_next">
			<%  if(nextPage == 1) {
			%>
				<a href="/baodacraft/pagedProduct?pageIndex=<%=nextPage%>&productType=<%=productType%>"><%=nextLabel%></a>
			<%
				} else if(!hasNextPages) {
			%>
				<a href="/baodacraft/pagedProduct?pageIndex=<%=nextPage - 2%>&productType=<%=productType%>"><%=prevLabel%></a>
			<%
					
				} else {
			%>
				<a href="/baodacraft/pagedProduct?pageIndex=<%=nextPage - 2%>&productType=<%=productType%>"><%=prevLabel%></a> <a href="/baodacraft/pagedProduct?pageIndex=<%=nextPage%>&productType=<%=productType%>"><%=nextLabel%></a>
			<%		
				}
			%>
		</div>
		<%}%>
	</div>
	
	<div class="wrapper_footer">
	  <div class="copyright">&copy;Copyright <a href="mailto:skeeey.liu@gmail.com">skeeey.liu</a></div>
	</div>
</body>
</html>